package top.atcra.rpc.transport.utils;

import java.nio.charset.StandardCharsets;


public class MessageFormatConstant {
    // 魔数
    public final static byte[] PROTOCOL_ID = "Cra".getBytes(StandardCharsets.UTF_8);

    // 协议版本号
    public final static byte VERSION = 1;

    // 首部长度字段所占用的字节数
    public final static short HEADER_LENGTH = (byte) (PROTOCOL_ID.length + 1 + 2 + 4 + 1 + 1 + 1 + 8 + 8);

    // 最大帧的长度
    public final static int MAX_FRAME_LENGTH = 1024 * 1024;

    // 版本号字段所占字节数
    public static final int VERSION_FILED_LENGTH = 1;

    // 消息头长度字段所占字节数
    public static final int HEADER_FIELD_LENGTH = 2;

    // 消息体长度字段所占字节数
    public static final int FULL_FIELD_LENGTH = 4;
}
